<template>
    <view>
        <view class="cu-list menu sm-border">
            <view class="cu-item" v-for="order in orders">
                <view class="content padding-tb-sm">
                    <view>
                        <text class="cuIcon-order text-yellow margin-right-xs"></text>
                        {{order.ordersId}}
                        <!--                        {{order.device.deviceName}}-->
                    </view>

                    <view class="text-gray text-sm" v-if="!order.cashOut">
                        <text class="cuIcon-mobile margin-right-xs"></text>
                        {{order.deviceName}}
                    </view>
                    <view class="text-red text-df" v-if="order.cashOut">
                        <text class="cuIcon-moneybag margin-right-xs"></text>
                        ￥{{order.amount.toFixed(2)}}
                    </view>
                    <view class="text-gray text-sm">
                        <text class="cuIcon-time margin-right-xs"></text>
                        {{order.createdDate}}
                    </view>
                </view>
                <view class="action">
                    <view :class="order.cashOut?'bg-orange':'bg-green'" class="cu-tag round light ">
                        {{order.cashOut?'提现':'销售'}}
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script lang="ts">
    import Vue from 'vue';
    import {http} from "@/utils/utils";
    import {appInfo} from "@/common/helper";

    export default Vue.extend({
        data() {
            return {
                orders: []
            };
        },
        onLoad() {
            http.get("api/ma/orders", {unionId: appInfo.session.unionid})
                .then((res: any) => {
                    console.log(res);
                    this.orders = res.data
                })
        }
    })
</script>

<style>

</style>
